<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xSite Administrator's Control Panel</title>
<link rel="stylesheet" href="./php.net.cn/xsite/admin/images/admincp.css" type="text/css" media="all" />
<meta content="xSite Inc." name="Copyright" />
<script src="admin/js/common.js" type="text/javascript"></script>

<script type="text/javascript" src="php.net.cn/xsite/skin/jq/jquery.js"></script>
<script type="text/javascript" src="php.net.cn/xsite/tool/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="php.net.cn/xsite/tool/ckfinder/ckfinder.js"></script>

</head>
<body>
<div id="append"></div>
<script type="text/javascript">
	function headermenu(ctrl) {
		ctrl.className = ctrl.className == 'otherson' ? 'othersoff' : 'otherson';
		var menu = document.getElementById('header_menu_body');
		if(!menu) {
			menu = document.createElement('div');
			menu.id = 'header_menu_body';
			menu.innerHTML = '<ul>' + document.getElementById('header_menu_menu').innerHTML + '</ul>';
			var obj = ctrl;
			var x = ctrl.offsetLeft;
			var y = ctrl.offsetTop;
			while((obj = obj.offsetParent) != null) {
				x += obj.offsetLeft;
				y += obj.offsetTop;
			}
			menu.style.left = x + 'px';
			menu.style.top = y + ctrl.offsetHeight + 'px';
			menu.className = 'togglemenu';
			menu.style.display = '';
			document.body.appendChild(menu);
		} else {
			menu.style.display = menu.style.display == 'none' ? '' : 'none';
		}
	}
	
</script>



<div class="container">
  
	<h3 class="marginbot">编辑HTML代码 <a href="xsite.php?action=block&operation=list">碎片列表</a></h3>
	
  <div class="note fixwidthdec">
    <p class="i">你可以对下面的HTML碎片代码进行设置。</p>
  </div>
  
  <div class="mainbox">
	编辑器开关：<a style="cursor:hand" onclick="create_editor('html_code');">[开]</a><a style="cursor:hand" onclick="close_editor();">[关]</a>
    <form action="xsite.php?action=block&operation=edit&key=<?=$key?>" method="post" enctype="multipart/form-data" name="html_edit" id="html_edit">   
      <table class="inputlist">
        <tr>
		  <th colspan="3" nowrap="nowrap"><label>
		      <textarea name="html_code" style="width:600px; height:400px" id="html_code" cols="45" rows="5"><?=$html_code?></textarea>
          </label></th>
        </tr>
      </table>
      <p>
        <label>
          <input type="submit" name="dosubmit" value=" 保存编辑 " class="btn" tabindex="3" />

        </label>
      </p>
    </form>
	  
    <div class="margintop"></div>
    

  </div>
</div>


<script type="text/javascript">
//<![CDATA[

var editor_status = 0;

var editor = null;

function close_editor() {
	if (editor_status != 1) {
		return false;
	}
	
	editor.destroy();
	editor_status = 0;
}

function create_editor(div){
	
	if (editor_status != 0) {
		return false;
	}
	
	window.editor = CKEDITOR.replace( div,
	{
		height:'400px',
		width:'600px',
		
		toolbar:
		[
			['Source','-','NewPage','Preview','-','Templates'],
			['Cut','Copy','Paste','PasteText','PasteFromWord'],
			['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
			['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
			'/',
			['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
			['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
			['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
			['Link','Unlink','Anchor'],
			['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
			'/',
			['Styles','Format','Font','FontSize'],
			['TextColor','BGColor']
		]
	});
	CKFinder.setupCKEditor( editor, { basePath : '<?=SITE_PATH?>/tool/ckfinder/', rememberLastFolder : false });
	
	editor_status = 1;
}

<?php if(isset($auto_start_editor) && $auto_start_editor != 4){?>
create_editor('html_code');
<?php }?>

//]]>
</script>

</body>
</html>
